
import * as THREE from "three";
import { scene } from "./sence"
import { Animal, moveto } from "../events/move"
import aaapng from "../assets/img/aaa.png"
import bbbpng from "../assets/img/bbb.png"
var textureLoader = new THREE.TextureLoader();
let cubeTexture=textureLoader.load(aaapng);
let cubeTexture2=textureLoader.load(bbbpng);
// const buildingMaterial = new THREE.MeshStandardMaterial({color: 0x75d1c2})
const buildingMaterial = new THREE.MeshStandardMaterial({map: cubeTexture})
const box = new THREE.Mesh(
    new THREE.BoxGeometry(0.4,0.4,0.4),
    buildingMaterial
)



box.position.set(1,0.1,0)
scene.add(box)
console.log(buildingMaterial)
moveto(box,{x:0.9,z:-2},1000)
console.log(buildingMaterial.map)
console.log(cubeTexture)
// cubeTexture.image = textureLoader.load(bbbpng);
// buildingMaterial = {map:cubeTexture2}
setTimeout(()=>{
    box.material.map = cubeTexture2
},2000)


// buildingMaterial.map = {cubeTexture}
// console.log(buildingMaterial.map={})


// textureLoader.load('../../public/img/aaa.png', function(texture) {
//     buildingMaterial
// })

const shu = new Animal([cubeTexture,cubeTexture2],100,10,"小怪",10,2000)